Skip to content

webserver.py: Change Pin 15 to Pin LED #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged

webserver.py: Change Pin 15 to Pin LED #66

merged 1 commit into from
Jan 22, 2024

Conversation

pkoscik
Copy link
Contributor

@pkoscik pkoscik commented May 12, 2023

This example does not work correctly RPI Pico W. Accessing the light/on and light/off endpoints does not toggle the LED state.

This patch fixes the issue.

@pkoscik pkoscik changed the title wireless: Change Pin 15 to Pin LED webserver.py: Change Pin 15 to Pin LED May 12, 2023
@lurch
Copy link
Contributor

lurch commented Aug 8, 2023

See section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf - I believe this PR is redundant?

@bwenrich
Copy link

Confirming that the existing sample code does not toggle the LED in my environment (Pico W with MicroPython v1.22.1). Manually managing a different pin number for Pico and Pico W is not complex, but is annoying. ex: https://forums.raspberrypi.com/viewtopic.php?t=336836 In recent versions of MicroPython this should no longer be necessary.

If I am reading correctly, MicroPython 1.20 introduces support for the Pin("LED", Pin.OUT) syntax via the "named pins" feature, which is also the first time they are providing a Pico W-specific build. Considering that this example is most relevant for the Pico W's network hardware, maintaining compatibility with older releases for the Pico may not be too concerning.

My opinion is that this PR would be helpful for two reasons:

  • Improves the user experience. New users who try these samples on the current version of MicroPython will get a functioning example
  • Consistency with other examples in this repo. This syntax is already used in other examples such as the basic blink.py
    led = Pin("LED", Pin.OUT)

@dpgeorge
Copy link

See section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf

This example in the datasheet there suggests that an external LED is connected to GPIO 15, and so the code is written assuming such a wiring. I guess that's done to teach how to wire up parts, rather than relying on the built-in LED.

If I am reading correctly, MicroPython 1.20 introduces support for the Pin("LED", Pin.OUT) syntax via the "named pins" feature,

Yes that is correct. It's now possible to access the built-in LED on both the Pico and Pico W using Pin("LED"). So the example code could be changed to use the built-in LED, but then any external LED that's wired to GPIO 15 wouldn't work.

@aallan aallan merged commit 956d008 into raspberrypi:master Jan 22, 2024
@aallan
Copy link
Contributor

aallan commented Jan 22, 2024

Reverted #71.

See the description of this example in Section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf. This was never supposed to work with the onboard LED so shouldn't be using the LED pragma.

@aallan aallan added the wontfix This will not be worked on label Jan 22, 2024
@pkoscik pkoscik deleted the wireless_fix_pin branch January 24, 2024 16:17
@lurch lurch mentioned this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants